package cheme.Application.actions;

import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ActionFactory;

public abstract class ChemeActionFactory
{
	
	public static final ActionFactory CONSOLE = new ActionFactory("console") //$NON-NLS-1$
    {
        /* (non-Javadoc)
         * @see org.eclipse.ui.actions.ActionFactory#create(org.eclipse.ui.IWorkbenchWindow)
         */
        public IWorkbenchAction create(IWorkbenchWindow window)
        {
            if (window == null)
            {
                throw new IllegalArgumentException();
            }
            
            IWorkbenchAction action = new ShowConsoleAction(window);
            action.setId(getId());
            
            return action;
        }
    };
	/**
     * Workbench action (id "new"): Save the active editor. This action
     * maintains its enablement state.
     */
    public static final ActionFactory NEW = new ActionFactory("new") //$NON-NLS-1$
    {
        /* (non-Javadoc)
         * @see org.eclipse.ui.actions.ActionFactory#create(org.eclipse.ui.IWorkbenchWindow)
         */
        public IWorkbenchAction create(IWorkbenchWindow window)
        {
            if (window == null)
            {
                throw new IllegalArgumentException();
            }
            
            IWorkbenchAction action = new NewFileAction(window);
            action.setId(getId());
            
            return action;
        }
    };
    
    /**
     * Workbench action (id "open"): Save the active editor. This action
     * maintains its enablement state.
     */
    public static final ActionFactory OPEN = new ActionFactory("open") //$NON-NLS-1$
    {
        /* (non-Javadoc)
         * @see org.eclipse.ui.actions.ActionFactory#create(org.eclipse.ui.IWorkbenchWindow)
         */
        public IWorkbenchAction create(IWorkbenchWindow window)
        {
            if (window == null)
            {
                throw new IllegalArgumentException();
            }
            
            IWorkbenchAction action = new OpenFileAction(window);
            action.setId(getId());
            
            return action;
        }
    };
    
	/**
     * Workbench action (id "save"): Save the active editor. This action
     * maintains its enablement state.
     */
    public static final ActionFactory SAVE = new ActionFactory("save") //$NON-NLS-1$
    {
        /* (non-Javadoc)
         * @see org.eclipse.ui.actions.ActionFactory#create(org.eclipse.ui.IWorkbenchWindow)
         */
        public IWorkbenchAction create(IWorkbenchWindow window)
        {
            if (window == null)
            {
                throw new IllegalArgumentException();
            }
            
            IWorkbenchAction action = new SaveFileAction(window);
            action.setId(getId());
            
            return action;
        }
    };
    
    /**
     * Workbench action (id "save"): Save the active editor. This action
     * maintains its enablement state.
     */
    public static final ActionFactory SAVEAS = new ActionFactory("save-as") //$NON-NLS-1$
    {
        /* (non-Javadoc)
         * @see org.eclipse.ui.actions.ActionFactory#create(org.eclipse.ui.IWorkbenchWindow)
         */
        public IWorkbenchAction create(IWorkbenchWindow window)
        {
            if (window == null)
            {
                throw new IllegalArgumentException();
            }
            
            IWorkbenchAction action = new SaveFileAsAction(window);
            action.setId(getId());
            
            return action;
        }
    };
}
